package com.example.jepack_nav

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import androidx.navigation.Navigation
import com.example.jepack_nav.databinding.ActivityMainBinding
import com.example.jepack_nav.databinding.FragmentMainBinding


class MainFragment : Fragment() {
    private lateinit var binding:FragmentMainBinding
    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        binding = FragmentMainBinding.inflate(inflater,container,false)
        var root:View = binding.root

//        binding.btnToSecondFragment.setOnClickListener(View.OnClickListener {
//            Navigation.findNavController(it)
//                .navigate(R.id.action_mainFragment_to_secondFragment)
//        })
        binding.btnToSecondFragment.setOnClickListener(Navigation.createNavigateOnClickListener(
            R.id.action_mainFragment_to_secondFragment
        ))
        return root
    }

}



